package com.car.dao.impl;

<<<<<<< HEAD
import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.car.dao.DaoInterface;
import com.car.entity.Driver;
import com.car.util.BaseDao;
import com.car.util.JdbcUtil;

public class DriverDaoImpl extends BaseDao<Driver> implements DaoInterface<Driver>{

	/**
	 * @throws SQLException 
	 * 天加用户
	 */
	@Override
	public int insert(Driver t) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "insert  dirver values(?,?,?,?,?,?,?,?,?,?,?) ";
		int update = JdbcUtil.run.update(sql,t.getDid(),t.getFno(),
				t.getSname(),t.getSsex(),t.getSyear(),t.getSid(),
				t.getSnumber(),t.getSold(),t.getSclass(),t.getStel(),
				t.getSprice());
		return update;
	}

	@Override
	/**
	 * 通过工号删除
	 */
	public int delete(int id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "delete  from dirver where snumber=? ";
		int update = JdbcUtil.run.update(sql,id);
		
		return update;
	}


	@Override
	/**
	 * 修改司机信息
	 */
	public int update(Driver t) throws SQLException {
		// TODO Auto-generated method stub
		String sql ="update dirver set did=?,fno=?,sname=?,"
					+ "ssex=?,syear=?,sid=?,snumber=?,sold=?,"
					+ "sclass=?,stel=?,sprice=? where s_id=?";
		int update = JdbcUtil.run.update(sql,t.getDid(),t.getFno(),t.getSname(),
						t.getSsex(),t.getSyear(),t.getSid(),t.getSnumber(),
						t.getSold(),t.getClass(),t.getStel(),t.getSprice(),t.getS_id());
		return update;
	}

	@Override
	/**
	 * 查询所有司机信息
	 */
	public List<Driver> queryAll() throws SQLException {
		// TODO Auto-generated method stub
		String sql = "selcet * from dirver";
		List<Driver> list = JdbcUtil.run.query(sql, new BeanListHandler<Driver>(Driver.class));
		return list;
	}

	@Override
	/**
	 * 通过s_id查询司机
	 */
	public Driver queryById(int id) {
		// TODO Auto-generated method stub
		String sql ="select * from driver where s_id=?";
		Driver driver = queryOne(sql, Driver.class,id);
		return driver;
=======
import java.util.List;

import com.car.dao.DaoInterface;
import com.car.entity.Driver;

public class DriverDaoImpl implements DaoInterface<Driver>{

	@Override
	public int insert(Driver t) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delete(int id) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int update(Driver t) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<Driver> queryAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Driver queryById(int id) {
		// TODO Auto-generated method stub
		return null;
>>>>>>> branch 'master' of https://gitee.com/kangdg/car.git
	}

}
